package com.asap.demo.utils;

/**
 * @ClassName: Constants   
 * @Description: 常量类
 * @author: suyb@asiainfo-sec.com   
 * @date:2018年3月9日 上午9:37:38
 */
public final class Constants {
	
	
	
	private Constants() {}
	
	//广播变量名
	public static final String BROADCAST_FILTERDATA="filterData";
	public static final String BROADCAST_PROPERTIES = "proBroadcast";
	public static final String BROADCAST_RULES = "ruleBroadcast";
	public static final String BROADCAST_ATTR_GROUP_ITEM = "attrGroupItemBroadCast";
	public static final String BROADCAST_BLACK_WHITE_LIST = "blackwhitelist";
	public static final String MATCH_ALL="any";
	//规则json名
	public static final String CONFIG_JSON = "configJson";
	
	// redis 配置
	public static final String REDIS_HOSTS = "redis.hosts";
	public static final String REDIS_KEY_DEADLINE = "redis.key.deadline";
	public static final String REDIS_KEY_ADDITIONAL_TIME = "redis.key.additional.time";
	public static final String REDIS_MODE = "redis.mode";
	public static final String REDIS_URL = "redis.hosts";
	
	public static final String DB_MODE="db.mode";
	//MySQL 配置
	public static final String DB_JDBC_DRIVER = "db.jdbc.driver";
	public static final String DB_JDBC_URL = "db.jdbc.url";
	public static final String DB_JDBC_USER = "db.jdbc.user";
	public static final String DB_JDBC_PASSWD = "db.jdbc.password";
	//Oracle 配置
	public static final String ORACLE_JDBC_DRIVER = "oracle.jdbc.driver";
	public static final String ORACLE_JDBC_URL = "oracle.jdbc.url";
	public static final String ORACLE_JDBC_USER = "oracle.jdbc.user";
	public static final String ORACLE_JDBC_PASSWD = "oracle.jdbc.password";
		
	//kafka配置
	public static final String KAFKA_BROKER = "kafka.broker";
	public static final String RULE_ENGINE_TOPIC = "rule.engine.topic";
	public static final String RULE_ALARM_TOPIC = "rule.engine.alarm.topic";
	public static final String RULE_EVENT_TOPIC = "rule.engine.output.topic";
	
	public static final String TO_SOLR_TOPIC="rule.engine.topic.toSolr";
	public static final String SOLR_COLLECTION_NAME = "collection.name";
	public static final String SOLR_SOURCE_TYPE = "source.type";
	
	//streaming 批处理时长
	public static final String STREAMING_DURATION = "streaming.duration";
	public static final String CONSUMER_OFFSEET = "consumer.offset";
	
	//数据库连接池配置
	public static final String INITAL_POOL_SIZE = "initial.pool.size";
	public static final String MIN_POOL_SIZE = "min.pool.size";
	public static final String MAX_POOL_SIZE = "max.pool.size";
	public static final String MAX_STATE_ELEMENTS = "max.state.ements";
	public static final String MAX_IDLE_TIME = "max.idle.time";
	
	//程序参数个数
	public static final int PARAM_NUMBER = 2;
	public static final int SYSTEM_EXIT = -1;
	
	//分隔符
	public static final String COMMA_SEPARATOR = ",";
	public static final String COLON_SEPARATOR = ":";
	public static final String OVER_TIME = "over.time";
	
	//Cache过期时间，单位秒
	public static final int CACHE_EXPIRED_TIME = 86400;
	public static final String CACHE_OUTPUT_KEYS = "CHCHE:OUTPUT:LIST";
	public static final String CACHE_OUTPUT_KEYS_CONTINUTY = "CHCHE:OUTPUT:LISTCONTINUTY";
	public static final String CACHE_OUTPUT_KEYS_DISTINCT = "CHCHE:OUTPUT:LISTDISTINCT";

	//分组统计的类型
	public static final String GROUP_SUM = "1";
	public static final String GROUP_COUNT = "2";
	//默认输出配置
	public static final String DEFAULT_OUTPUT = "event.hdfs.parquet.schema";
	public static final String SOLR_MSG_HEADER="event.head";
	public static final String ACCUMULATED_SERVERITY="accumulated.serverity";
	
	public static final String INNER_IP="inner_ip";
	public static final String CELL_PHONE="cell_phone";
	public static final String ID_CARD="id_card";
	public static final String MAIL="mail";
	public static final String USER_ACCOUNT="user";

	public static final String INNERIP_MATCH = "^(127\\.0\\.0\\.1)|(localhost)|(10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(172\\.((1[6-9])|(2\\d)|(3[01]))\\.\\d{1,3}\\.\\d{1,3})|(192\\.168\\.\\d{1,3}\\.\\d{1,3})$";  //匹配内网ip （127.0.0.1, 10.0.0.0--10.255.255.255 ,172.16.0.0--172.31.255.255 ,192.168.0.0--192.168.255.255 ）
    public static final String PHONE_MATCH = "^[1][3,4,5,7,8][0-9]{9}$";
    public static final String SFZ_MATCH = "(^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx])|([1−9]\\d5\\d2((0[1−9])|(10|11|12))(([0−2][1−9])|10|20|30|31)\\d2[0−9Xx])";
    public static final String MAIL_MATCH = "^([a-zA-Z0-9]+[_|\\-|\\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\\-|\\.]?)*[a-zA-Z0-9]+(\\.[a-zA-Z]{2,3})+$";
	public static final String USER_MATCH = "^[a-zA-Z0-9_-]{6,16}$";   //(字母数字，下划线，6-16位长度)

	public static final String COMMON_USR="COMMON_USE";
	public static final String BLACK_LIST="black_list";
	public static final String WHITE_LIST="white_list";

	/**
	 * IP_SECTION:  具体的IP范围
	 * 	      EXAMPLE:	192.168.1.1-192.168.1.254
	 * IP_SEGMENT:  IP/CIDR
	 * 		  EXAMPLE:  192.168.1.0/24
	 */
	public static final String IP_SECTION = "IP_SECTION";
	public static final String IP_SEGMENT = "IP_SEGMENT";
	/** buffer key **/
	public static final String IP_SECTIONS_KEY = "SVBfU0VDVElPTlM=";
}
